
/*var arr = ['小小','大大','方方','圆圆'];
arr.join(',');

abb = arr.slice(0,3)

console.log('欢迎'+abb+'和'+arr[3]+'同学！')*/



var strs = ['flower','flow','flight']


var longestCommonPrefix = function(strs) {
if(strs.length == 0) 
            return '';

        let ans = strs[0];

        for(let i =1;i<strs.length ; i++) {
            let j=0;
            for(;j<ans.length && j < strs[i].length;j++) {
                if(ans[j] != strs[i][j])
                    break;
            }
            ans = ans.substr(0, j);
            if(ans === (''))
                return ans;
        }
        return ans;
}
console.log(ans);